Learn R Programming

GISTools (version 1.0-2)

Add masking around an image: Draw a mask around a Grid Based Image

Description

Takes an `mask' type polygon object - basically a rectangle with a polygon hole cut through it - and draws this over an image. This has the effect of only showing the image inside the hole. This is useful for plotting surfaces defined over a study area, but masking the values outside of the area.

Usage

add.masking(maskPoly,color)

Value

None

Arguments

maskPoly

A masking polygon of a “Spatial” or “sf” class as described above.

color

Colour of the mask. Defaults to white, but for example, sea could be shown as blue.

Author

Chris Brunsdon, Binbin Lu

Details

Returns no value, but draws a mask on the current graphics device as a side effect

See Also

poly.outer, kde.points.

Examples

Run this code
  # \donttest{
# Data for New Haven to use in example
data(newhaven)
# Do the KDE
breach.dens = kde.points(breach,lims=tracts)
# Plot the result
level.plot(breach.dens)
# Block out the part outside the study area
masker = poly.outer(breach.dens,tracts,extend=100); add.masking(masker)
add.masking(masker,"blue")
  # }

Run the code above in your browser using DataLab